home *** CD-ROM | disk | FTP | other *** search
/ Interactive Media Design Review 1999 / Interactive Media Design Review 1999.iso / mac / files / ID99MENU.DIR / 00011_icon control script.ls < prev    next >
Encoding:
Text File  |  1999-04-29  |  8.0 KB  |  250 lines

  1. property s, mysmallloc, mysmallwidth, mysmallheight, mymediumloc, mymediumwidth, mymediumheight, mybwmember, mycolormember, mysmallrect, mymediumrect, mypercent, fullon, insmall, inmedium, scaleup, scaledown, scalepercent, mymerit, mymovestart, myDelay, goscreenshot, mycurrwidth, mycurrheight, mycurrloc, mybigmember, switchedtext
  2. global learnedsizes, tickrate, firstthumbnail, screenshotloc, screenshotwidth, screenshotheight, currtitle, rollvolume, rollstep
  3.  
  4. on beginSprite me
  5.   s = me.spriteNum
  6.   mycolormember = the memberNum of sprite s
  7.   bwmember = member(mycolormember).name
  8.   delete char -30001 of bwmember
  9.   if the last char in bwmember = SPACE then
  10.     delete char -30000 of bwmember
  11.   end if
  12.   put " bw" after bwmember
  13.   bigmember = member(mycolormember).name
  14.   delete char -30001 of bigmember
  15.   if the last char in bigmember = SPACE then
  16.     delete char -30000 of bigmember
  17.   end if
  18.   put " big" after bwmember
  19.   mybwmember = the number of member bwmember
  20.   mybigmember = the number of member bigmember
  21.   mypercent = 100
  22.   insmall = 0
  23.   inmedium = 0
  24.   mymerit = word 1 of bwmember
  25.   goscreenshot = 0
  26. end
  27.  
  28. on learnsmallsize me
  29.   mysmallloc = the loc of sprite s
  30.   mysmallwidth = the width of sprite s
  31.   mysmallheight = the height of sprite s
  32.   mysmallrect = the rect of sprite s
  33. end
  34.  
  35. on learnmediumsize me
  36.   mymediumloc = the loc of sprite s
  37.   mymediumwidth = the width of sprite s
  38.   mymediumheight = the height of sprite s
  39.   mymediumrect = the rect of sprite s
  40. end
  41.  
  42. on prepareFrame me
  43.   if not learnedsizes then
  44.     exit
  45.   end if
  46.   if goscreenshot then
  47.     moveicontoscreen()
  48.     exit
  49.   end if
  50.   if scaleup or scaledown then
  51.     moveicon()
  52.     exit
  53.   end if
  54.   if the memberNum of sprite s = mybigmember then
  55.     exit
  56.   end if
  57.   onsmallloc = the loc of sprite s = mysmallloc
  58.   onmediumloc = the loc of sprite s = mymediumloc
  59.   if (inside(the mouseLoc, mysmallrect) and onsmallloc) or sprite(s + 100).insmall then
  60.     insmall = 1
  61.   end if
  62.   if (inside(the mouseLoc, mymediumrect) and onmediumloc) or sprite(s + 100).insmall then
  63.     inmedium = 1
  64.   end if
  65.   if insmall or inmedium then
  66.     rollvolume = rollvolume + rollstep
  67.     sprite(s + 100).inpartner = 1
  68.     if mypercent = 100 then
  69.       insmall = inside(the mouseLoc, mysmallrect) and onsmallloc
  70.       inmedium = inside(the mouseLoc, mymediumrect) and onmediumloc
  71.       exit
  72.     end if
  73.     mypercent = min(100, mypercent + tickrate)
  74.   else
  75.     sprite(s + 100).inpartner = 0
  76.     if mypercent = 0 then
  77.       exit
  78.     end if
  79.     mypercent = max(0, mypercent - tickrate)
  80.   end if
  81.   if mypercent >= 50 then
  82.     set the memberNum of sprite s to mycolormember
  83.   else
  84.     set the memberNum of sprite s to mybwmember
  85.   end if
  86.   if onsmallloc then
  87.     newwidth = float(mysmallwidth) / 100 * (abs(50 - mypercent) * 2)
  88.     set the width of sprite s to newwidth
  89.     set the height of sprite s to mysmallheight
  90.   end if
  91.   if onmediumloc then
  92.     newwidth = float(mymediumwidth) / 100 * abs(50 - mypercent) * 2
  93.     set the width of sprite s to newwidth
  94.     set the height of sprite s to mymediumheight
  95.   end if
  96. end
  97.  
  98. on mouseUp me, fromlist, thetitle
  99.   if fromlist = 1 then
  100.     if thetitle = (s - firstthumbnail + 1) then
  101.       currtitle = thetitle
  102.       sendSprite(s, #growdown, mymerit, thetitle)
  103.     end if
  104.     exit
  105.   end if
  106.   onsmallloc = the loc of sprite s = mysmallloc
  107.   onmediumloc = the loc of sprite s = mymediumloc
  108.   if onsmallloc then
  109.     sendAllSprites(#growup, mymerit)
  110.   end if
  111.   if onmediumloc then
  112.     sprite(s).locZ = 1000
  113.     currtitle = thetitle
  114.     sendAllSprites(#growdown, mymerit, s - firstthumbnail + 1)
  115.   end if
  116. end
  117.  
  118. on growdown me, themerit, thetitle
  119.   if the loc of sprite s = screenshotloc then
  120.     sprite(s).locZ = 1000
  121.   else
  122.     sprite(s).locZ = s
  123.   end if
  124.   mycurrwidth = the width of sprite s
  125.   mycurrheight = the height of sprite s
  126.   mycurrloc = the loc of sprite s
  127.   if thetitle = (s - firstthumbnail + 1) then
  128.     goscreenshot = 1
  129.     scaleup = 0
  130.     scaledown = 0
  131.     switchedtext = 0
  132.     set the memberNum of sprite s to mybigmember
  133.     scalepercent = 0
  134.     exit
  135.   end if
  136.   goscreenshot = 0
  137.   if mymerit = themerit then
  138.     scaledown = 1
  139.     scaleup = 0
  140.     scalepercent = 100
  141.     mymovestart = the ticks
  142.     myDelay = random(60)
  143.   end if
  144. end
  145.  
  146. on growup me, themerit
  147.   if the loc of sprite s = screenshotloc then
  148.     sprite(s).locZ = 1000
  149.   else
  150.     sprite(s).locZ = s
  151.   end if
  152.   if mymerit = themerit then
  153.     scaledown = 0
  154.     scaleup = 1
  155.     scalepercent = 0
  156.     mymovestart = the ticks
  157.     myDelay = random(30)
  158.     mycurrwidth = the width of sprite s
  159.     mycurrheight = the height of sprite s
  160.     mycurrloc = the loc of sprite s
  161.   else
  162.     if the loc of sprite s <> mysmallloc then
  163.       growdown(me, mymerit)
  164.     end if
  165.   end if
  166. end
  167.  
  168. on moveicon
  169.   if the ticks < (mymovestart + myDelay) then
  170.     exit
  171.   end if
  172.   if scaleup then
  173.     if (the loc of sprite s <> mymediumloc) or (scalepercent < 100) then
  174.       if scalepercent = 100 then
  175.         set the loc of sprite s to mymediumloc
  176.       else
  177.         set the locH of sprite s to mycurrloc.locH + (float(mymediumloc.locH - mycurrloc.locH) / 100 * scalepercent)
  178.         set the locV of sprite s to mycurrloc.locV + (float(mymediumloc.locV - mycurrloc.locV) / 100 * scalepercent)
  179.         scalepercent = min(100, scalepercent + tickrate)
  180.       end if
  181.     else
  182.       if (the width of sprite s <> mymediumwidth) or (the height of sprite s <> mymediumheight) then
  183.         set the width of sprite s to mycurrwidth + (float(mymediumwidth - mycurrwidth) / 100 * (scalepercent - 100))
  184.         set the height of sprite s to mycurrheight + (float(mymediumheight - mycurrheight) / 100 * (scalepercent - 100))
  185.         scalepercent = min(200, scalepercent + tickrate)
  186.       else
  187.         scaleup = 0
  188.         set the memberNum of sprite s to mybwmember
  189.       end if
  190.     end if
  191.     exit
  192.   end if
  193.   if scaledown then
  194.     if (the width of sprite s <> mysmallwidth) or (the height of sprite s <> mysmallheight) then
  195.       set the width of sprite s to mysmallwidth + (float(mycurrwidth - mysmallwidth) / 100 * scalepercent)
  196.       set the height of sprite s to mysmallheight + (float(mycurrheight - mysmallheight) / 100 * scalepercent)
  197.       scalepercent = max(0, scalepercent - tickrate)
  198.     else
  199.       if the loc of sprite s <> mysmallloc then
  200.         set the locH of sprite s to mysmallloc.locH + (float(mycurrloc.locH - mysmallloc.locH) / 100 * (scalepercent + 100))
  201.         set the locV of sprite s to mysmallloc.locV + (float(mycurrloc.locV - mysmallloc.locV) / 100 * (scalepercent + 100))
  202.         scalepercent = max(-100, scalepercent - tickrate)
  203.       else
  204.         scaledown = 0
  205.         set the memberNum of sprite s to mybwmember
  206.       end if
  207.     end if
  208.     exit
  209.   end if
  210. end
  211.  
  212. on moveicontoscreen
  213.   sprite(s).locZ = 1000
  214.   if (the loc of sprite s <> screenshotloc) or (scalepercent < 100) then
  215.     if scalepercent = 100 then
  216.       set the loc of sprite s to screenshotloc
  217.     else
  218.       set the locH of sprite s to mycurrloc.locH + (float(screenshotloc.locH - mycurrloc.locH) / 100 * scalepercent)
  219.       set the locV of sprite s to mycurrloc.locV + (float(screenshotloc.locV - mycurrloc.locV) / 100 * scalepercent)
  220.       scalepercent = min(100, scalepercent + tickrate)
  221.     end if
  222.   else
  223.     if not switchedtext then
  224.       sendAllSprites(#switchtext, s - firstthumbnail + 1)
  225.       currtitle = s - firstthumbnail + 1
  226.       switchedtext = 1
  227.     end if
  228.     if (the width of sprite s <> screenshotwidth) or (the height of sprite s <> screenshotheight) then
  229.       if scalepercent = 200 then
  230.         set the width of sprite s to screenshotwidth
  231.         set the height of sprite s to screenshotheight
  232.       else
  233.         set the width of sprite s to mycurrwidth + (float(screenshotwidth - mycurrwidth) / 100 * (scalepercent - 100))
  234.         set the height of sprite s to mycurrheight + (float(screenshotheight - mycurrheight) / 100 * (scalepercent - 100))
  235.         scalepercent = min(200, scalepercent + tickrate)
  236.       end if
  237.     else
  238.       set the loc of sprite s to screenshotloc
  239.       goscreenshot = 0
  240.     end if
  241.   end if
  242.   exit
  243. end
  244.  
  245. on checkclick me, clickedloc
  246.   if inside(clickedloc, mymediumrect) and (the loc of sprite s = mymediumloc) then
  247.     mouseUp()
  248.   end if
  249. end
  250.